export default class RoomTowerExtension extends Room 
{
    private _towers?:StructureTower[];
    public towers()
    {
        return this.getStructures(STRUCTURE_TOWER)
    }

    public focuseFire(creeps:Creep[]):boolean
    {
        // 能量不满不攻击
         
        for(const e of this.towers())
        {
            if(e.store.getUsedCapacity(RESOURCE_ENERGY)<50)
            {
                return false;
            }
        }
        for(const tower of this.towers())
        {
            tower.attack(creeps[0]);
        }
        return true
    }


    // 骚扰 ，随机攻击
    public harass(creeps:Creep[]):void
    {
        for(let idx=0;idx<this.towers().length;idx++)
        {
            const tower = this.towers()[idx];
            tower.attack(creeps[idx%creeps.length]);
        }
    }
}